import request from "@/utils/request";

// 商品列表单个数据类型
export interface ProductItemType {
  id?: number;
  tmName: string;
  logoUrl: string;
}

// 商品列表数据类型
export type ProductType = ProductItemType[];

// 商品分页列表数据类型
export interface ProductListType {
  records: ProductType;
  total: number;
  size: number;
  current: number;
  searchCount: boolean;
  pages: number;
}

// 请求商品分页列表数据
export const reqProductList = (page: number, limit: number) => {
  return request.get<null, ProductListType>(
    `/admin/product/baseTrademark/${page}/${limit}`
  );
};

// 请求添加品牌数据
export const reqAddTrademark = (tmInfo: ProductItemType) => {
  return request.post(`/admin/product/baseTrademark/save`, tmInfo);
};

// 请求修改品牌
export const reqUpdataTrademark = (tmInfo: ProductItemType) => {
  return request.put(`/admin/product/baseTrademark/update`, tmInfo);
};

// 请求删除品牌
export const reqDeleteTrademark = (id: number) => {
  return request.delete(`/admin/product/baseTrademark/remove/${id}`);
};

// 请求获取所有品牌数据
export const reqGetAllTrademark = () => {
  return request.get<null, ProductType>(
    `/admin/product/baseTrademark/getTrademarkList`
  );
};
